package org.softee.extractor.helper;

public class Logger {
    private static final boolean DEBUG = false;
    private final String loggerName;

    public Logger(String loggerName) {
        this.loggerName = loggerName;
    }

    public Logger(Class<?> logger) {
        this(logger.getName());
    }

    public Logger() {
        this.loggerName = null;
    }

    public void log(String format, Object... args) {
        if (DEBUG) {
            StringBuilder sb = new StringBuilder(100);
            if (loggerName != null) {
                sb.append(loggerName).append(": ");
            }
            if (args.length == 0) {
                sb.append(format);
            } else {
                sb.append(String.format(format, args));
            }
            System.out.println(sb);
        }
    }

}
